package com.wu.example;

import android.os.Handler;
import android.util.Log;

/**
 * eg <br>
 * onclick="window.android.callAndroid('hello from Browser')"><br>
 * 
 * @author frankswu
 * 
 */
public class AndroidBridge {

	private final Handler handler = new Handler();
	private static final String TAG = "AndroidBridge";
	private IJavaScriptAndroidBridge js;

	public AndroidBridge(IJavaScriptAndroidBridge js) {
		this.js = js;
	}

	public void callAndroid(final String arg) {// must be final
		handler.post(new Runnable() {

			@Override
			public void run() {
				Log.d(TAG, "callAndroid(" + arg + ")");
				js.doSomeing(arg);
			}
		});
	}

}
